{{extend 'layout.html'}}

<h2 class="fancy">Member Preferences</h2>

{{include 'default/err_check.html'}}

{{if request.vars.upd:}}<p class="info">* Preferences have been updated. *</p>{{pass}}

<form method="post" id="user_edit_form" action="" enctype="multipart/form-data">
    <fieldset id="user_edit_form_fields">
        <input type="hidden" id="form_submitted" name="form_submitted" value="1" />
        <input type="hidden" id="user_id" name="user_id" value="{{=user_id}}" />

        <table cellspacing="2" cellpadding="2">
            <tbody>
                <tr>
                    <td>Email:</td>
                    <td><a href="mailto:{{=user_email}}" title="Email {{=user_email}}">{{=user_email}}</a></td>
                </tr>
                <tr>
                    <td>Username:</td>
                    <td><input type="text" style="width:200px;"
                               name="username"
                               id="username"
                               value="{{=request.vars.get('username', view_info['props']['username'])}}" />
                    <i class="note">* This will display in you postings, search, etc.</i>
                    </td>
                </tr>
                <tr>
                    <td>New Password:</td>
                    <td><input type="password" style="width:500px;" name="new_passwd" id="new_passwd"
                    value="" /> <i class="note">* Leave empty for no change</i></td>
                </tr>
                <tr>
                    <td>New Password Confirmation:</td>
                    <td><input type="password" style="width:500px;" name="new_passwd_confirm" id="new_passwd_confirm"
                    value="" /> <i class="note">* Leave empty for no change</i></td>
                </tr>
                <tr>
                    <td>Real Name:</td>
                    <td><input type="text" style="width:500px;" name="real_name" id="real_name"
                    value="{{=request.vars.get('real_name', view_info['props']['real_name'])}}" /></td>
                </tr>
                <tr>
                    <td>Web Page:</td>
                    <td><input type="text" style="width:500px;" name="web_page" id="web_page"
                    value="{{=request.vars.get('web_page', view_info['props']['web_page'])}}" /></td>
                </tr>
                <tr>
                    <td>City/Country:</td>
                    <td><input type="text" style="width:500px;" name="country" id="country"
                    value="{{=request.vars.get('country', view_info['props']['country'])}}" /></td>
                </tr>
                <tr>
                    <td>Signature:</td>
                    <td>
                        <textarea id="signature" name="signature" cols="0" rows="0"
                        style="width:500px;height:100px;">{{=request.vars.get('signature', view_info['props']['signature'])}}</textarea>
                    </td>
                </tr>
                <tr>
                    <td><label for="allow_pm_use">Allow contact via PM:</label></td>
                    <td>
                        <input type="checkbox" id="allow_pm_use" name="allow_pm_use"
                        {{if request.vars.get('allow_pm_use', view_info['props']['allow_pm_use']):}}checked="checked"{{pass}} />
                    </td>
                </tr>
                <tr>
                    <td>Posts:</td>
                    <td>{{=view_info['props']['postings']}}</td>
                </tr>
                <tr>
                    <td>Last Login:</td>
                    <td>{{=view_info['props']['last_login']}}</td>
                </tr>
                <tr>
                    <td>Forum Subscriptions:</td>
                    <td>
                        {{if len(forum_subscriptions):}}
                            <select id="remove_forum_subscription" name="remove_forum_subscription"
                            multiple="multiple"
                            style="width:500px;height:100px;">
                                {{for f_sub in forum_subscriptions:}}
                                    <option value="{{=f_sub.id}}">{{=f_sub.forum_title}}</option>
                                {{pass}}
                            </select>
                        {{else:}}
                            Not subscribed to any forums.
                        {{pass}}
                    </td>
                </tr>
                <tr>
                    <td>Topic Subscriptions:</td>
                    <td>
                        {{if len(topic_subscriptions):}}
                            <select id="remove_topic_subscription" name="remove_topic_subscription" multiple="multiple"
                                    style="width:500px;height:100px;">
                                {{for f_sub in topic_subscriptions:}}
                                    <option value="{{=f_sub.id}}">{{=f_sub.title}}</option>
                                {{pass}}
                            </select>
                        {{else:}}
                            Not subscribed to any topics.
                        {{pass}}
                    </td>
                </tr>
                <tr>
                    <td>Avatar:</td>
                    <td>
                        {{if forumhelper.has_member_avatar(user_id):}}
                            <img src="{{=URL(r=request, c='zadmin', f='get_avatar_image', args=[user_id])}}" alt="" />
                            <label for="remove_avatar">Disable:</label>
                            <input type="checkbox" id="remove_avatar"
                            name="remove_avatar"
                            {{if request.vars.get('remove_avatar', ''):}}checked="checked"{{pass}} />
                            <br />
                        {{pass}}
                        <input type="file" id="avatar_data" name="avatar_data" />
                    </td>
                </tr>
            </tbody>
        </table>

        <p class="note">For Forums/Topics subscriptions, select the ones you wish to unsubscribe
        from and submit your form.</p>

        <div class="both-separator">
            <input type="submit" id="update_b" name="update_b" value="Update Profile" />
            <input type="submit" id="cancel_b" name="cancel_b" value="Cancel" />
        </div>
    </fieldset>
</form>
